from django.core.mail import send_mail

from dashopt.celery import app
from utils.sms import YunTongXunAPI
from django.conf import settings


@app.task
def async_send_active_email(email, verify_url,uname):
    '''
        功能函数：发送激活邮件
    '''
    subject = "清北录取通知书"
    html_message = f'''
    尊敬的{uname}同学，请点击连接填写录取信息～～～～～～
    <a href="{verify_url}" target="_blank">点击此处</a>
    '''
    send_mail(subject, "", "2805866836@qq.com", [email], html_message=html_message)

@app.task
def async_send_message(phone, code):
    sms_api = YunTongXunAPI(**settings.SMS_CONFIG)
    sms_api.run(phone, code)